-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heading: Add line height support #21215
Conversation
h4, | ||
h5, | ||
h6 { | ||
line-height: var(--wp--typography--line-height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this here instead https://github.com/WordPress/gutenberg/pull/21215/files#diff-f2f5efb13e0e16e61312aa9b0c028ae1R8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@youknowriad The link doesn't appear to be working for me 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few lines up in the same file (with the other variables) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Something like this?
:root {
h1,
h2,
h3,
h4,
h5,
h6 {
line-height: var(--wp--typography--line-height);
}
}
h1,
h2,
h3,
h4,
h5,
h6 {
background-color: var(--wp--color--background);
color: var(--wp--color--text);
&.has-background {
padding: $block-bg-padding--v $block-bg-padding--h;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think I missed the :root
thing when I merged the heading PR. I was thing more like this:
:root {
h1,
h2,
h3,
h4,
h5,
h6 {
background-color: var(--wp--color--background);
color: var(--wp--color--text);
line-height: var(--wp--typography--line-height);
}
}
h1,
h2,
h3,
h4,
h5,
h6 {
&.has-background {
padding: $block-bg-padding--v $block-bg-padding--h;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha! Thank you for clarifying :). I'll make those updates
Size Change: +124 B (0%) Total Size: 857 kB
ℹ️ View Unchanged
|
just want to confirm with the design team whether we want that feature in heading otherwise it LGTM |
Heading line height is a very good idea! It will create some nicer effects bringing in more importance to the header. Giving an option to the user to make the header stand out even better. |
Yes yes. Please include the line height on the Heading block. 👍 |
Description
This update adds
line-height
style support to the Heading block!How has this been tested?
Types of changes
supports: __experimentalLineHeight
This update adds
__experimentalLineHeight
to theHeading
block settings. This newsupports
attribute was defined when introduced line height to the Paragraph block.By adding this flag, the
LineHeightControl
and attribute is automatically added to the Editor, and the styles (CSS variables) are automatically rendered with the new internal hook.CSS
In order to render this change, we need to add CSS for the Heading block. We're leveraging the
:root
technique (renders::root h1, h2, h3, etc...
) that bumps the specificity in a relatively hands-off manner. There's discussion around this technique here: #21037Note: Depending on how a theme's CSS is coded, these new line-height styles may not render correctly (due to specificity)
Checklist:
Along with #20775, this PR resolves:
#20339